package com.etime.yqtsponsor.controller;

import com.etime.yqtsponsor.common.BaseMessage;
import com.etime.yqtsponsor.pojo.ActiveTimeLine;
import com.etime.yqtsponsor.service.ActiveTimeLineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: LouisLew
 * @date: 2022/07/20/14:58
 * @description: 活动各时间节点的控制层
 */
@Api(tags = "活动时间处理接口")
@RestController
@RequestMapping("/active/timeLine")
public class ActiveTimeLineController {
    @Autowired
    private ActiveTimeLineService activeTimeLineService;

    @ApiOperation("活动的开始结束时间，报名的开始结束时间")
    @GetMapping("/addActiveTimeLine")
    public BaseMessage addActiveTimeLine(ActiveTimeLine activeTimeLine){
        BaseMessage baseMessage = new BaseMessage();
        int timeLine = activeTimeLineService.addActiveTimeLine(activeTimeLine);
        if (timeLine > 0) {
            baseMessage.setCode(1);
            baseMessage.setMsg("添加成功");
        }
        return baseMessage;
    }
}
